<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            background-color: aqua;
            height: 100px;
        }
    </style>
</head>
<!-- computed 计算属性，本质上面还是属性，写法如函数，命名如属性-->
<body>
    <div id="app">
        <!-- 1.基本使用 -->
        <h4>基本使用</h4>
        <p> {{firstName + "·" + lastName}} </p>

        <!-- 2.通过方法获取 -->
        <h4>通过方法获取</h4>
        <p> {{getFullName()}} </p>

        <!-- 3.通过计算属性 -->
        <h4>通过计算属性获取</h4>
        <p> {{fullName}} </p>
    </div>
    <script src="js/vue.js"></script>

    <script>
        const HelloVue = {
            data(){
                return {
                    firstName: "乔治",
                    lastName: "希尔"
                }
            },
            // 计算属性
            computed:{
                /* 细节：本质上面还是属性，写法如函数，命名如属性 */
                fullName(){
                    return this.firstName + "·" + this.lastName;
                }
            },
            methods: {
                getFullName(){
                    return this.firstName + "·" + this.lastName;
                },
            }
        };

        const app = Vue.createApp(HelloVue).mount("#app");
       
    </script>
</body>
</html>